<!DOCTYPE html>
<html ng-app='test'>
  <head>
    <meta charset="utf-8">
    <title></title>
    <script src="angular.js"></script>
    <script type="text/javascript">
      let mod=angular.module('test',[]);

      mod.config(function($httpProvider){
        $httpProvider.defaults.headers.post['Content-Type']='application/x-www-form-urlencoded';

        $httpProvider.defaults.transformRequest=function(obj){
          let arr=[];

          for(let name in obj)
          {
            arr.push(`${name}=${obj[name]}`);
          }

          return arr.join('&');
        };
      });
      mod.controller('main',function($scope,$http){
        $http({
          method: 'post',
          url: 'post.php',
          data: {a:12,b:5}
        }).then(res=>{
          alert(res.data);
        },()=>{
          alert('error');
        });
      });
    </script>
  </head>
  <body ng-controller='main'>

  </body>
</html>
